/**
 * Copyright (C), 2015-2019, XXX有限公司
 * FileName: JSONSerializer
 * Author:   kadibeieun
 * Date:     2019/8/13 11:39
 * Description:
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 */
package messageCommunication.serialize.impl;

import clientLogin.serialize.SerializerAlogrithm;
import com.alibaba.fastjson.JSON;
import messageCommunication.serialize.Serializer;

/**
 * 〈一句话功能简述〉<br> 
 * 〈〉
 *
 * @author kadibeieun
 * @create 2019/8/13
 * @since 1.0.0
 */
public class JSONSerializer implements Serializer {
    @Override
    public byte getSerializerAlogrithm() {
        return SerializerAlogrithm.JSON;
    }


    @Override
    public byte[] serialize(Object object) {
        return JSON.toJSONBytes(object);
    }

    @Override
    public <T> T deserialize(Class<T> clazz, byte[] bytes) {
        return JSON.parseObject(bytes, clazz);
    }

}